package org.qb.mapreduce.extractedTransformLoad;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;

public class WebLogMapper extends Mapper<LongWritable, Text,Text, NullWritable> {

    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, NullWritable>.Context context) throws IOException, InterruptedException {

        //获取一行,通过space分割
        String[] split = value.toString().split(" ");

        //当一行中分割后的长度小于11的长度就退出
        if (split.length < 11){
            return;
        }

        context.write(value,NullWritable.get());
    }
}
